SelChange Event (DataGrid Control)

       

Occurs when the user selects a different range of rows or columns.

Syntax

Private Sub object_SelChange([ index As Integer,] cancel As Integer)

The SelChange event syntax has these parts:

Part Description
object An object expression that evaluates to an object in the Applies To list.
index An integer that identifies a control if it is in a control array.
cancel A Boolean expression that determines if a change is canceled, as described in Settings.

Settings

The settings for cancel are:

Setting Description
True If your event procedure sets the Cancel argument to True, the previous row and column selections (if any) are restored, and the SelStartCol, SelEndCol, and SelBookmarks properties revert to their previous values
False (Default) Continues with change.

Remarks

This event is triggered under several circumstances:

The current range of selected columns is provided by the SelStartCol and SelEndCol properties. The bookmarks of the selected rows are available in the collection provided by the SelBookmarks property. Within this event procedure, these properties reflect the user's pending selection(s).

This event is only triggered by user interaction with the grid. It cannot be triggered by code.

Note   When the user selects a column, any row selections are cleared. Similarly, when the user selects a row, any column selections are cleared.